<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="java.util.*" import="java.sql.*"%>
<%@page import="com.javabean.IsDeadline"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../js/jQuery1.82.js" type="text/javascript"></script>
<script type="text/javascript">
	function getCom(page, tem) {
		var req;
		if (tem == 0) {
			req = "ListBfDev";
		}
		if (tem == 1) {
			req = "select";
		}
		$.post(
						req,
						{
							requestPage : page,
							type : $("#sss").val(),
							shuru : $("#iii").val(),
							isUse : 'no'
						},
						function(data) {
							
							var json = data.dev;
							$(".resultList").remove();
							for ( var i = 0; i < (json.length - 1); i++) {
								$("#infos")
										.append(
												"<tr class='resultList' align='center'>"
														+ "<td bgcolor='#FFFFFF'><input type='checkbox' name='delid' value='"+json[i].did+"'/></td>"
														+ "<td height='20' bgcolor='#FFFFFF'><a href='#'>"
														+ json[i].name
														+ "</a></td>"
														+ "<td bgcolor='#FFFFFF'>"
														+ json[i].devid
														+ "</td>"
														+ "<td bgcolor='#FFFFFF'>"
														+ json[i].devmodel
														+ "</td>"
														+ "<td bgcolor='#FFFFFF'>"
														+ json[i].depart
														+ "</td>"
														+ "<td bgcolor='#FFFFFF'><a href='SB_BJ.jsp?devids="
														+ json[i].did
														+ "'>编辑</a>"
														+ " | <a href='SB_CK1.jsp?devids="
														+ json[i].did
														+ "'>查看</a>" + " | <a href='SB_ZY.jsp?devids="
														+ json[i].did
														+ "'>转移</a></td></tr>");

							}
							$("#totalset")
									.html(json[json.length - 1].totalPage);
							$("#curpage").html(json[json.length - 1].curPage);
							if (json[json.length - 1].curPage < json[json.length - 1].totalPage) {
								$("#nextpage").attr("dir",
										json[json.length - 1].curPage);
							}
							if (json[json.length - 1].curPage > 1) {
								$("#prepage").attr("dir",
										json[json.length - 1].curPage);
							}
						}, "json");
	}
	$(document).ready(function() {
		getCom(1, 0);
		/*Get next page */
		$("#nextpage").live("click", function() {
			if ($("#nextpage").attr("dir") != "0") {
				var page = parseInt($("#nextpage").attr("dir")) + 1;
				getCom(page, 0);
			}
		});
		/*Get preceding page */
		$("#prepage").live("click", function() {
			if ($("#nextpage").attr("dir") != "0") {
				var page = parseInt($("#prepage").attr("dir")) - 1;
				getCom(page, 0);
			}
		});

		$("#tiao").click(function() {
			if ($("p").val() > 1 && $("p").val() < $("#totalset").html()) {
				getCom(1, 0);
			}
		});
	});
</script>
<title></title>
<style type="text/css">
<!--
body {
	background-color: #fff;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.tabfont01 {
	font-family: "宋体";
	font-size: 9px;
	color: #555555;
	text-decoration: none;
	text-align: center;
}

.font051 {
	font-family: "宋体";
	font-size: 12px;
	color: #333333;
	text-decoration: none;
	line-height: 20px;
}

.font201 {
	font-family: "宋体";
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}

.button {
	font-family: "宋体";
	font-size: 14px;
	height: 37px;
}

html {
	overflow-x: auto;
	overflow-y: auto;
	border: 0;
}
-->
</style>

<link href="../css/css.css" rel="stylesheet" type="text/css" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
	
</script>
<script language=JavaScript>
	document.onkeydown=function(event){
   	 	var e = document.all ? window.event : event; 
    	
   		if(e && e.keyCode==13){ // enter 键
 			return false;
   			//要做的事情
    	}
 	};
	function sbbj() {
		opener.document.getElementById("mainFrame")
	}
	function sousuo() {
		window
				.open(
						"gaojisousuo.htm",
						"",
						"depended=0,alwaysRaised=1,width=800,height=510,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0");
	}
	function selectAll() {
		var obj = document.fom.elements;
		for ( var i = 0; i < obj.length; i++) {
			if (obj[i].name == "delid") {
				obj[i].checked = true;
			}
		}
	}

	function unselectAll() {
		var obj = document.fom.elements;
		for ( var i = 0; i < obj.length; i++) {
			if (obj[i].name == "delid") {
				if (obj[i].checked == true)
					obj[i].checked = false;
				else
					obj[i].checked = true;
			}
		}
	}

	function CanelBfDev(){
		var obj = document.fom.elements;
		var x = 0;
		for (var i=0; i<obj.length; i++ ){
		  if(obj[i].name == "delid"){
			  if(obj[i].checked == true){
				  x++;
			  }
		  }
		}
		if(x>0){
			if(confirm("确认取消报废？")){
				document.fom.action="DeviceDeal?flag=scrap_cancel";
				document.fom.submit();
			}
		}
		else{
			alert("请选择需要取消报废的设备");
			return;
		}
	}
	
	function go_cancel(){
		document.getElementById("fom").action = "listSB.jsp";
		document.getElementById("fom").submit();
	}
</script>
</head>

<body>
	<form action="DeviceDeal?flag=translate" name="fom" id="fom" method="post">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">

			<tr>
				<td height="30">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td height="62" background="../image/widgetbg5.jpg">

								<table width="98%" border="0" align="center" cellpadding="0"
									cellspacing="0">
									<tr>
										<td width="24"><img src="../images/ico07.gif" width="20"
											height="18" /></td>
										<td width="519"><select name="select2" id="sss">
												<option>设备名称</option>
												<option>设备编号</option>
										</select> <input name="textfield" type="text" size="12" id="iii" /><input name="Submit" type="button"
												 value="查 询" onclick="getCom(1,1)" /></td>
										<td width="679" align="left"><a href="#"
											onclick="sousuo()"> </a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td><table id="subtree1" style="DISPLAY:" width="100%"
						border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td><table width="95%" border="0" align="center"
									cellpadding="5" cellspacing="0">
									<tr>
										<td height="20"><span class="newfont07">选择：<a
												href="#" class="right-font08" onclick="selectAll();">全选</a>-
												<a href="#" class="right-font08" onclick="unselectAll();">反选</a></span>
											 <input name=""
											type="button"  value="取消报废"
											onclick="CanelBfDev();" />
											 <input name="cancel" type="button" value="返回设备列表" onclick="go_cancel();"/>
										</td>
									</tr>
									<tr>
										<td height="40" class="font42">
											<table id="infos" width="100%" border="0" cellpadding="4"
												cellspacing="1" bgcolor="#464646" class="newfont03">
												<tr>
													<td height="20" colspan="15" align="center" class="tablestyle_title">设备信息列表</td>
												</tr>
												<tr>
													<td width="5%" align="center" class="zsd">选择</td>
													<td width="30%" height="20" align="center"
														class="zsd">设备名称</td>
													<td width="15%" align="center" class="zsd">设备编号</td>
													<td width="15%" align="center" class="zsd">设备型号</td>
													<td width="20%" align="center" class="zsd">使用部门</td>
													<td width="15%" align="center" class="zsd">操作</td>
												</tr>
											</table>
										</td>
									</tr>
								</table></td>
						</tr>
					</table>
					<table width="95%" border="0" align="center" cellpadding="0"
						cellspacing="0">
						<tr>
							<td height="6"><img src="../images/spacer.gif" width="1"
								height="1" /></td>
						</tr>
						<tr>
							<td height="33"><table width="100%" border="0"
									align="center" cellpadding="0" cellspacing="0"
									class="right-font08">
									<tr>
										<td width="50%">共 <span id="totalset"
											class="right-text09">5</span> 页 | 第 <span id="curpage"
											class="right-text09">1</span> 页
										</td>
										<td width="49%" align="right">[<a id="headpage" href="#"
											class="right-font08">首页</a> | <a id="prepage" dir="0"
											href="#" class="right-font08">上一页</a> | <a id="nextpage"
											dir="0" href="#" class="right-font08">下一页</a> | <a
											id="finalpage" href="#" class="right-font08">末页</a>] 转至：
										</td>
										<td width="1%"><table width="20" border="0"
												cellspacing="0" cellpadding="0">
												<tr>
													<td width="1%"><input id="p" name="textfield3"
														type="text" class="right-textfield03" size="1" /></td>
													<td width="87%"><input id="tiao" name="Submit23222"
														type="submit" class="right-button06" value=" " /></td>
												</tr>
											</table></td>
									</tr>
								</table></td>
						</tr>
					</table></td>
			</tr>
		</table>
	</form>
</body>
</html>